import BTAction from "./BTActionNode";
import BTBlackboard from "./BTBlackboard";
import BTNode from "./BTNode";
/**
 * 行为树
 */
export default class BehaviorTree {
    root: BTNode;
    blackboard: BTBlackboard
    constructor(root: BTNode, blackboard?: BTBlackboard) {
        this.root = root;
        this.blackboard = blackboard;
    }

    update() {
        this.root.update();
    }

    private static _actions: Record<string, BTAction> = {};

    static registerAction(name: string, action: BTAction) {
        this._actions[name] = action;
    }

    static unregisterAction(name: string) {
        delete this._actions[name];
    }

    static clear() {
        this._actions = {};
    }
}
